<?php

define('IN_SCRIPT', 1);
define('HESK_PATH', './');
define('HESK_NO_ROBOTS', 1);

/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/database.inc.php');

hesk_session_start();

$category = urldecode($_GET['category']);

hesk_dbConnect();

$cat = $_GET['category'];

/* Get ticket info */
$sql = "SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "diag_parent_cat` WHERE name = '$cat'";
$result = hesk_dbQuery($sql);

$row = hesk_dbFetchAssoc($result);
$cat_id = $row['id'];

$sql = "SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "diag_categories` WHERE parent_id = '$cat_id'";;
$result = hesk_dbQuery($sql);

while ($row = hesk_dbFetchAssoc($result)) {
    echo '<option>';
    echo($row['name']);
    echo '</option>';
}